function r2_mean = model_r2_mean(b,time,parameters)
C2 = b(1);
sigma2 = b(2)*b(1);

mode = parameters(1);

r2_mean = zeros(size(time));
for i = 1:length(time)
    r2 = 0.0;
    for m = 0:mode
        for n = 0:mode
            if(m~=0||n~=0)
                lambda = -4.0*C2*(m^2+n^2);
                temp1 = exp(2*lambda*time(i));
                if(m==0||n==0)
                    r2 = r2+2*sigma2*(temp1-1)/(2*lambda);
                else
                    r2 = r2+4*sigma2*(temp1-1)/(2*lambda);
                end
            end
        end
    end
    r2_mean(i) = r2/(pi*pi);
end

